<?php
    require('DataMapper.php');
    require('bookmarkTDG_model.php');
    require('BookmarkDO.php');
    /*
     *  Class:      BookmarkMapper
     *  Purpose:    This class will handle all the access between the Domain Objects 
     *              and the TDG's.
     */
    
    class BookmarkMapper extends DataMapper {
        public static function findById($bm) {
            $b = new Bookmark();
            $b = bookmarkTDG_model::findById($bm->getId(), $bm->getVersion());
            
            return $b;
        }
        
        public static function findAll() {
            $bList = array();
            
            $bList = bookmarkTDG_model::findAll();
            
            return $bList;            
        }
        
        public static function update($bm) {
            bookmarkTDG_model::update($bm->getId(), $bm->getVersion(), $bm->getMenuItemId(),
                    $bm->getUserId(), $bm->getRestaurantId());                        
        }
        
        public static function insert($bm) {
            bookmarkTDG_model::insert($bm->getMenuItemId(), $bm->getUserId(), $bm->getRestaurantId());
        }
        
        public static function delete($bm) {
            bookmarkTDG_model::delete($bm->getId(), $bm->getVersion());
        }
    }
?>
